package com.f.controller;

import com.f.bean.Dept;
import com.f.bean.EmpDept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

@RestController
public class DeptController {
    @Autowired
    private RestTemplate restTemplate;

    // 直接走数据库
    @RequestMapping("dept/getAll")
    public List<Dept> getAll(){
        List<Dept> list = restTemplate.getForObject("http://PROVIDER1/dept/getAll", List.class);
        return list;
    }
}
